package com.deyuanyun.pic.pipe.controller.vo.merge;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.controller.vo.BaseVO;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.pipe.domain.Gww;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.util.ArrayList;
import java.util.List;

/**
 * 环焊缝信息表
 */
public class GwwVO extends BaseVO<Gww> {

    // 管道名称
    private String pipeLineName;
    // 环焊缝焊接编号
    private String gwwNumber;
    // 绝对距离(m)
    private String mileage;
    // wps编号(自定义编号)
    private String wpsNumber;
    // 施工单位
    private String assemblyCompany;
    // 施工日期
    private String constructionDate;
    // 相对最近参考点
    private String reference;
    // 相对最近参考点距离(m)
    private String referenceDistance;
    // 链接计算结果表
    private String gisId;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getGwwNumber() {
        return gwwNumber;
    }

    public void setGwwNumber(String gwwNumber) {
        this.gwwNumber = gwwNumber;
    }

    public String getMileage() {
        return mileage;
    }

    public void setMileage(String mileage) {
        this.mileage = mileage;
    }

    public String getWpsNumber() {
        return wpsNumber;
    }

    public void setWpsNumber(String wpsNumber) {
        this.wpsNumber = wpsNumber;
    }

    public String getAssemblyCompany() {
        return assemblyCompany;
    }

    public void setAssemblyCompany(String assemblyCompany) {
        this.assemblyCompany = assemblyCompany;
    }

    public String getConstructionDate() {
        return constructionDate;
    }

    public void setConstructionDate(String constructionDate) {
        this.constructionDate = constructionDate;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public String getReferenceDistance() {
        return referenceDistance;
    }

    public void setReferenceDistance(String referenceDistance) {
        this.referenceDistance = referenceDistance;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    @Override
    public void fromDomain(Gww domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 环焊缝焊接编号
        this.gwwNumber = domain.getGwwNumber();
        // 绝对距离(m)
        this.mileage = NumberFormat.format(domain.getMileage(), NumberFormat.FMT_PLACES3);
        // wps编号(自定义编号)
        this.wpsNumber = domain.getWpsNumber();
        // 施工单位
        this.assemblyCompany = domain.getAssemblyCompany();
        // 施工日期
        this.constructionDate = DateFormat.format(domain.getConstructionDate());
        // 相对最近参考点
        this.reference = domain.getReference();
        // 相对最近参考点距离(m)
        this.referenceDistance = NumberFormat.format(domain.getReferenceDistance(), NumberFormat.FMT_PLACES3);
        // 链接GIS结果表
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public List<GwwVO> fromDomainList(List<Gww> domainList) {
        List<GwwVO> list = new ArrayList<GwwVO>();
        for (Gww gww : domainList) {
            GwwVO gwwVO = new GwwVO();
            gwwVO.fromDomain(gww);
            list.add(gwwVO);
        }
        return list;
    }
}